<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <script src="../plugins/echarts/echarts.js"></script>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>套餐收入统计</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>套餐收入统计</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <span class="demonstration">日期选择</span>
            <el-date-picker
                    v-model="value1"
                    type="daterange"
                    align="right"
                    unlink-panels
                    range-separator="至"
                    :start-placeholder="startPlaceholder"
                    :end-placeholder="endPlaceholder"
                    value-format="yyyy-MM-dd"
                    :picker-options="pickerOptions">
            </el-date-picker>
            <input type="button" @click="wasc()" value="查询">
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>

        </div>
    </div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript">
    var  vue = new Vue({
        el: '#app',
        data:{
            pickerOptions: {
                shortcuts: [{
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }]
            },
            startPlaceholder: new Date(new Date().getTime()-7*24*60*60*1000).getFullYear()+'-'

                +((new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1)>=10?
                    (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1):
                    "0"+ (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1))+'-'+

                ((new Date(new Date().getTime()-6*24*60*60*1000).getDate())>=10?
                    (new Date(new Date().getTime()-6*24*60*60*1000).getDate()):
                    "0"+(new Date(new Date().getTime()-6*24*60*60*1000).getDate())),
            endPlaceholder: new Date().getFullYear()+'-'+
                ((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):"0"+((new Date().getMonth()+1)))+'-'+
                (((new Date().getDate())>=10?(new Date().getDate()):"0"+((new Date().getDate())))),

            value1:''
        },
        methods:{
            wasc(){
                if (this.value1!=''){
                    axios.post("/report/getSetmealReportMoneyDate.do?value1="+this.value1).then((res)=>{


                        if (res.data.flag){
                            echarts.init(document.getElementById('chart1')).setOption({
                                tooltip: {
                                    trigger: 'item',
                                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                                },
                                legend: {
                                    orient: 'vertical',
                                    left: 10,
                                    data: res.data.data.name
                                },
                                series: [
                                    {
                                        name: '访问来源',
                                        type: 'pie',
                                        radius: ['50%', '70%'],
                                        avoidLabelOverlap: false,
                                        label: {
                                            show: false,
                                            position: 'center'
                                        },
                                        emphasis: {
                                            label: {
                                                show: true,
                                                fontSize: '30',
                                                fontWeight: 'bold'
                                            }
                                        },
                                        labelLine: {
                                            show: false
                                        },
                                        data: res.data.data
                                    }
                                ]
                            });
                        }else {
                            this.$message.error(res.data.message);
                        }






                    });
                }else {
                    this.$message.error("请选择一个时间段");
                    return false;
                }

                //alert(this.value1);
            },
        },

    });

    axios.get("/report/getSetmealReportMoney.do").then((res)=>{
        echarts.init(document.getElementById('chart1')).setOption({
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b}: {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 10,
                data: res.data.data.names
            },
            series: [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius: ['50%', '70%'],
                    avoidLabelOverlap: false,
                    label: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        label: {
                            show: true,
                            fontSize: '30',
                            fontWeight: 'bold'
                        }
                    },
                    labelLine: {
                        show: false
                    },
                    data: res.data.data.moneys
                }
            ]
        });
    });
</script>
</html>









<!--<!DOCTYPE html>-->
<!--<html>-->
<!--<head>-->
<!--    &lt;!&ndash; 页面meta &ndash;&gt;-->
<!--    <meta charset="utf-8">-->
<!--    <meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<!--    <title>传智健康</title>-->
<!--    <meta name="description" content="传智健康">-->
<!--    <meta name="keywords" content="传智健康">-->
<!--    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">-->
<!--    &lt;!&ndash; 引入样式 &ndash;&gt;-->
<!--    <link rel="stylesheet" href="../css/style.css">-->
<!--    <link rel="stylesheet" href="../plugins/elementui/index.css">-->
<!--    <script src="../plugins/echarts/echarts.js"></script>-->
<!--</head>-->
<!--<body class="hold-transition">-->
<!--<div id="app">-->
<!--    <div class="content-header">-->
<!--        <h1>统计分析<small>套餐收入统计</small></h1>-->
<!--        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">-->
<!--            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>统计分析</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>套餐收入统计</el-breadcrumb-item>-->
<!--        </el-breadcrumb>-->
<!--    </div>-->
<!--    <div class="app-container">-->
<!--        <div class="box">-->
<!--            <span class="demonstration">日期选择</span>-->
<!--            <el-date-picker-->
<!--                    v-model="value1"-->
<!--                    type="daterange"-->
<!--                    align="right"-->
<!--                    unlink-panels-->
<!--                    range-separator="至"-->
<!--                    :start-placeholder="startPlaceholder"-->
<!--                    :end-placeholder="endPlaceholder"-->
<!--                    value-format="yyyy-MM-dd"-->
<!--                    :picker-options="pickerOptions">-->
<!--            </el-date-picker>-->
<!--            <input type="button" @click="wasc()" value="查询">-->
<!--            &lt;!&ndash; 为 ECharts 准备一个具备大小（宽高）的 DOM &ndash;&gt;-->
<!--            <div id="chart1" style="height:600px;"></div>-->

<!--        </div>-->
<!--    </div>-->
<!--</div>-->
<!--</body>-->
<!--&lt;!&ndash; 引入组件库 &ndash;&gt;-->
<!--<script src="../js/vue.js"></script>-->
<!--<script src="../js/axios-0.18.0.js"></script>-->
<!--<script src="../plugins/elementui/index.js"></script>-->
<!--<script type="text/javascript">-->
<!--    var  vue = new Vue({-->
<!--        el: '#app',-->
<!--        data:{-->
<!--            pickerOptions: {-->
<!--                shortcuts: [{-->
<!--                    text: '最近一周',-->
<!--                    onClick(picker) {-->
<!--                        const end = new Date();-->
<!--                        const start = new Date();-->
<!--                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);-->
<!--                        picker.$emit('pick', [start, end]);-->
<!--                    }-->
<!--                }, {-->
<!--                    text: '最近一个月',-->
<!--                    onClick(picker) {-->
<!--                        const end = new Date();-->
<!--                        const start = new Date();-->
<!--                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);-->
<!--                        picker.$emit('pick', [start, end]);-->
<!--                    }-->
<!--                }, {-->
<!--                    text: '最近三个月',-->
<!--                    onClick(picker) {-->
<!--                        const end = new Date();-->
<!--                        const start = new Date();-->
<!--                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);-->
<!--                        picker.$emit('pick', [start, end]);-->
<!--                    }-->
<!--                }]-->
<!--            },-->
<!--            startPlaceholder: new Date().getFullYear()+'-'+-->
<!--                ((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):"0"+((new Date().getMonth()+1)))+'-'+-->
<!--                (((new Date().getDate())>=10?(new Date().getDate()):"0"+((new Date().getDate())))),-->

<!--            endPlaceholder: new Date().getFullYear()+'-'+-->
<!--                ((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):"0"+((new Date().getMonth()+1)))+'-'+-->
<!--                (((new Date().getDate())>=10?(new Date().getDate()):"0"+((new Date().getDate())))),-->

<!--            value1:''-->
<!--        },-->
<!--        methods:{-->
<!--            wasc(){-->
<!--                if (this.value1!=''){-->
<!--                    axios.post("/report/getSetmealReportMoneyDate.do?value1="+this.value1).then((res)=>{-->


<!--                        if (res.data.flag){-->
<!--                            echarts.init(document.getElementById('chart1')).setOption({-->
<!--                                tooltip: {-->
<!--                                    trigger: 'item',-->
<!--                                    formatter: '{a} <br/>{b}: {c} ({d}%)'-->
<!--                                },-->
<!--                                legend: {-->
<!--                                    orient: 'vertical',-->
<!--                                    left: 10,-->
<!--                                    data: res.data.data.name-->
<!--                                },-->
<!--                                series: [-->
<!--                                    {-->
<!--                                        name: '访问来源',-->
<!--                                        type: 'pie',-->
<!--                                        radius: ['50%', '70%'],-->
<!--                                        avoidLabelOverlap: false,-->
<!--                                        label: {-->
<!--                                            show: false,-->
<!--                                            position: 'center'-->
<!--                                        },-->
<!--                                        emphasis: {-->
<!--                                            label: {-->
<!--                                                show: true,-->
<!--                                                fontSize: '30',-->
<!--                                                fontWeight: 'bold'-->
<!--                                            }-->
<!--                                        },-->
<!--                                        labelLine: {-->
<!--                                            show: false-->
<!--                                        },-->
<!--                                        data: res.data.data-->
<!--                                    }-->
<!--                                ]-->
<!--                            });-->
<!--                        }else {-->
<!--                            this.$message.error(res.data.message);-->
<!--                        }-->






<!--                    });-->
<!--                }else {-->
<!--                    this.$message.error("请选择一个时间段");-->
<!--                    return false;-->
<!--                }-->

<!--                //alert(this.value1);-->
<!--            },-->
<!--        },-->

<!--    });-->

<!--    axios.get("/report/getSetmealReportMoney.do").then((res)=>{-->
<!--        echarts.init(document.getElementById('chart1')).setOption({-->
<!--            tooltip: {-->
<!--                trigger: 'item',-->
<!--                formatter: '{a} <br/>{b}: {c} ({d}%)'-->
<!--            },-->
<!--            legend: {-->
<!--                orient: 'vertical',-->
<!--                left: 10,-->
<!--                data: res.data.data.name-->
<!--            },-->
<!--            series: [-->
<!--                {-->
<!--                    name: '访问来源',-->
<!--                    type: 'pie',-->
<!--                    radius: ['50%', '70%'],-->
<!--                    avoidLabelOverlap: false,-->
<!--                    label: {-->
<!--                        show: false,-->
<!--                        position: 'center'-->
<!--                    },-->
<!--                    emphasis: {-->
<!--                        label: {-->
<!--                            show: true,-->
<!--                            fontSize: '30',-->
<!--                            fontWeight: 'bold'-->
<!--                        }-->
<!--                    },-->
<!--                    labelLine: {-->
<!--                        show: false-->
<!--                    },-->
<!--                    data: res.data.data-->
<!--                }-->
<!--            ]-->
<!--        });-->
<!--    });-->
<!--</script>-->
<!--</html>-->
